import React, {Component} from 'react';
import {Icon, Popconfirm, Table} from 'antd';

export default class OrderTable extends Component {

    constructor(props) {
        super(props);
    }

    render() {
        const rowSelection = {
            onChange: this.props.checkChange
        };
        const columns = [{
            title: '订单编号',
            dataIndex: 'userOrderFlows[0].wechatTradeNo'
        },{
            title: '学员手机号',
            dataIndex: 'tUser.phoneNum'
        },{
            title: '学员微信号',
            dataIndex: 'tUser.wechatNum'
        },{
            title: '导师姓名',
            dataIndex: 'tutorInfo.tUser.fullName'
        },{
            title: '咨询问题',
            dataIndex: 'question'
        },{
            title: '订单金额',
            dataIndex: 'price'
        },{
            title: '订单状态',
            dataIndex: 'status',
            render: (text, record) => 
                <div>  
                    {text == 1 ? "未支付" : (text == 2 ? "已支付" : (text == 3 ? "失效订单" : (text == 4 ? "导师接单" : (text == 5 ? "已交易" : 
                    (text == 6 ? "取消订单" : (text == 7 ? "退款订单" : (text == 8 ? "待评价" : (text == 9 ? "评论完成" : null)))))))) }
                </div>
        },{
            title: '下单时间',
            dataIndex: 'userOrderStatuses[0].createTime'
        }
        // , {
        //     title: '操作',
        //     width: 100,
        //     render: (text, record) =>
        //         <div className='opera'>
        //             <span onClick={() => this.props.editClick(record.id)}>
        //                  <Icon type="edit"/> 详情
        //             </span><br/>
        //         </div>
        // }
    ];
        return (
            <Table
                rowSelection={rowSelection}
                columns={columns}
                dataSource={this.props.dataSource}
                bordered={true}
                scroll={{x: '100%'}}
                className='formTable'
                loading={this.props.loading}
                pagination={{  //分页
                    total: this.props.total, //数据总数量
                    pageSize: this.props.pageSize,
                    current: this.props.current,
                    showSizeChanger: true,  //是否显示可以设置几条一页的选项
                    showTotal: () => `共${this.props.total}条`,
                    onChange: (current,pageSize) => this.props.pageSizeChange(current, pageSize)
                }}
            />
        )
    }
}
